<?php

if($_POST['act']=='op')
{
	if(is_array($_POST['chk']))
	{
		$id=implode(",",$_POST['chk']);
		$sql="delete from ".PROSTOCK." where id in ($id)";
		$db->query($sql);
		msg("?m=product&s=product_stock.php");
	}
}
if($_GET['action'] == 'check'){
	$sql="update ".PROSTOCK." set status = 1 where id = '$_GET[id]' ";
	$db->query($sql);
	msg("?m=product&s=product_stock.php");
}

if($_GET['action'] == 'del'){
	$sql="delete from ".PROSTOCK." where id = '$_GET[id]' ";
	$db->query($sql);
	msg("?m=product&s=product_stock.php");
}

$sql="select * from ".PROSTOCK." where 1  order by id desc";
//====================
include_once("../includes/page_utf_class.php");
$page = new Page;
$page->listRows=10;
if (!$page->__get('totalRows')){
	$db->query($sql);
	$page->totalRows = $db->num_rows();
}
$sql .= "  limit ".$page->firstRow.",".$page->listRows;
//=====================
$db->query($sql);
$de['list']=$db->getRows();
$de['page'] = $page->prompt();

$tpl->assign("de",$de);
$tpl->assign("config",$config);
$tpl->display("product_stock.htm");
?>